home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / oleo-1_4.lha / oleo-1.4 / window.h < prev    next >
C/C++ Source or Header  |  1993-03-29  |  6KB  |  202 lines

  1.  
  2. #ifndef WINDOWH
  3. #define WINDOWH
  4.  
  5. /*    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this software; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20. /*  t. lord    Mon Aug 10 14:51:25 1992    */
  21.  
  22. #include "cell.h"
  23. #include "line.h"
  24.  
  25. /* The tty windows datastructures: */
  26.  
  27.  
  28. struct window
  29. {
  30.   /* Do not change these directly. */
  31.   int id;
  32.   int win_over;            /* Where the data in this window starts */
  33.   int win_down;            /*   on the screen.  */
  34.   struct rng screen;        /* Cells visible. recenter_* updates this. */
  35.   int flags;            /* You must use io_set_win_flags and perhaps */
  36.                 /*   io_recenter_cur_win */
  37.  
  38.   /* Number of lines of spreadsheet that can fit in this window.
  39.      This only changes when the screen is resized,
  40.      win->flags&WIN_EDGES changes, or a window is either
  41.      created or destroyed */
  42.   int numr;
  43.   
  44.   /* Number of text columns that can fit in this window.
  45.      This changes when the screen is resized,
  46.      win->flags&WIN_EDGES changes, a window is created or
  47.      destoryed, or win->lh_wid changes.  In the last case
  48.      win->numc+win->lh_wid remains a constant. */
  49.   int numc;
  50.   
  51.   /* 
  52.    * Number of columns and rows for right and bottom edges. 
  53.    * As this changes, numc and numr change accordingly.
  54.    */
  55.   int bottom_edge_r;
  56.   int right_edge_c;
  57.  
  58.   /* These values may be changed at any time. */
  59.   /* -1 if this window isn't linked to any others, else
  60.      contains the index into wins of the window this one is
  61.      linked to */
  62.   int link;
  63.  
  64.   /* Number of columns taken up by the row numbers at the
  65.      left hand edge of the screen.  Zero if edges is
  66.      win->flags&WIN_EDGES is off (by definition).  Seven (or
  67.      five) if win->flags&WIN_PAG_HZ (to make things easier).
  68.      Ranges between three "R9 " to seven "R32767 " depending on
  69.      the number of the highest row on the screen.  */
  70.   int lh_wid;
  71.  
  72.   
  73.   /* Cursor row/column in this window */
  74.   /* Note that the external variables curow, cucol are used for
  75.      the currently active cursor position, so if you want
  76.      cwin->curow and cwin->cucol to be accurate, you have to
  77.      set them yourself. */
  78.   CELLREF win_curow;
  79.   CELLREF win_cucol;
  80.  
  81.   VOIDSTAR *win_slops;    /* Slops in this window (tty only) */
  82. };
  83.  
  84. struct mouse_event
  85. {
  86.   int seq;
  87.   int row;
  88.   int col;
  89.   int button;
  90.   int downp;
  91.   int location;            /* See #defines, below. */
  92.   CELLREF r;
  93.   CELLREF c;
  94.   struct mouse_event * next;
  95.   struct mouse_event * prev;
  96. };
  97.  
  98. /* Window flags:
  99.    0x01    Locked horizontally
  100.    0x02    Locked vertically
  101.    0x04    Page Horizontally
  102.    0x08    Page Vertically
  103.    0x10    Edges disabled
  104.    0x20    Edges standout
  105.    */
  106. #define WIN_LCK_HZ    0x01
  107. #define WIN_LCK_VT    0x02
  108. #define WIN_PAG_HZ    0x04
  109. #define WIN_PAG_VT    0x08
  110. #define WIN_EDGES    0x10
  111. #define WIN_EDGE_REV    0x20
  112.  
  113. /* Do not change these directly. */
  114. extern int scr_lines;
  115. extern int scr_cols;
  116. extern int input;        /* An approximation that makes sense. */
  117. extern int status;
  118. extern int user_input;        /* What the user actually asked for. */
  119. extern int user_status;
  120. extern int formulas_visible;
  121. extern int input_rows;
  122. extern int status_rows;
  123. extern int label_rows;
  124. extern int label_emcols;
  125.  
  126.  
  127. extern int nwin;
  128. extern struct window * wins;
  129. extern struct window * cwin;
  130.  
  131.  
  132. extern struct mouse_event last_mouse_event;
  133.  
  134. extern int info_rows;        /* The height of one row of info in a */
  135.                 /* multi-line message. */
  136.  
  137. /* This is stored as the button number when a dequeue failes. */
  138. #define MOUSE_QERROR    -1
  139. /* These are the possible mouse locations. */
  140. #define MOUSE_ON_INPUT    -1
  141. #define MOUSE_ON_STATUS   -2
  142. #define MOUSE_ON_EDGE      -3
  143.  
  144. #define MOUSE_CHAR '\034'
  145.  
  146. #ifdef __STDC__
  147. extern int win_label_cols (struct window * win, CELLREF hr);
  148. extern int win_label_rows (struct window * win);
  149. extern void io_set_label_size (int r, int c);
  150. extern void io_set_scr_size (int lines, int cols);
  151. extern void io_set_input_rows (int n);
  152. extern void io_set_status_rows (int n);
  153. extern void io_set_input_status (int inp, int stat, int redraw);
  154. extern void io_set_cwin (struct window *win);
  155. extern void io_pr_cell (CELLREF r, CELLREF c, CELL *cp);
  156. extern void io_redo_region (struct rng * rng);
  157. extern void io_win_open (int hv, int where);
  158. extern void io_win_close (struct window *win);
  159. extern void io_move_cell_cursor (CELLREF rr, CELLREF cc);
  160. extern void io_shift_cell_cursor (int dirn, int repeat);
  161. extern void io_scroll_cell_cursor (int magic, int repeat);
  162. extern void io_recenter_cur_win (void);
  163. extern void io_recenter_all_win (void);
  164. extern void io_set_win_flags (struct window *w, int f);
  165. extern void io_write_window_config (struct line * out);
  166. extern void io_read_window_config (char * line);
  167. extern int enqueue_mouse_event (int r, int c, int button, int downp);
  168. extern void dequeue_mouse_event (struct mouse_event *out, int seq);
  169. extern void io_init_windows (int sl, int sc, int ui, int us, int ir, int sr,
  170.          int lr, int lc) ;
  171.  
  172. #else
  173. extern int win_label_cols ();
  174. extern int win_label_rows ();
  175. extern void io_set_label_size ();
  176. extern void io_set_scr_size ();
  177. extern void io_set_input_rows ();
  178. extern void io_set_status_rows ();
  179. extern void io_set_input_status ();
  180. extern void io_set_cwin ();
  181. extern void io_pr_cell ();
  182. extern void io_redo_region ();
  183. extern void io_win_open ();
  184. extern void io_win_close ();
  185. extern void io_move_cell_cursor ();
  186. extern void io_shift_cell_cursor ();
  187. extern void io_scroll_cell_cursor ();
  188. extern void io_recenter_cur_win ();
  189. extern void io_recenter_all_win ();
  190. extern void io_set_win_flags ();
  191. extern void io_write_window_config ();
  192. extern void io_read_window_config ();
  193. extern int enqueue_mouse_event ();
  194. extern void dequeue_mouse_event ();
  195. extern void io_init_windows ();
  196.  
  197. #endif
  198.  
  199. #endif
  200.  
  201.  
  202.